package fem2.gui;

class LoadStepMgrAdapter implements LoadStepMgr {

	private ModelRenderer modelRenderer_;
	private int ts;

	public LoadStepMgrAdapter(ModelRenderer modelRenderer) {
		modelRenderer_ = modelRenderer;
	}

	@Override
	public int getLoadStepCount() {
		// return modelRenderer_.getModelHolder().getModel().countTimesteps() ==
		// 0 ? 0
		// : 1;
		return 0;
	}

	@Override
	public int getSubstepCount(int loadStep) {
		// return modelRenderer_.getModelHolder().getModel().countTimesteps();
		return 0;
	}

	@Override
	public double getTime(int loadStep, int substep) {
		// return modelRenderer_.getModelHolder().getModel()
		// .getAnalysisTime(substep);
		return 0;
	}

	@Override
	public void restore(int loadStep, int substep) {
		ModelHolder mh = modelRenderer_.getModelHolder();
		this.ts = substep;
		// mh.getModel().setTimestep(substep);
		mh.fireSolvedEvent();
		modelRenderer_.renderModel();
	}

	@Override
	public int getCurrentLoadStep() {
		return 1;
	}

	@Override
	public int getCurrentSubstep() {
		return ts;
	}

	@Override
	public double getCurrentTime() {
		return getCurrentLoadStep();
	}
}
